package com.sure.user.service.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.sure.common.dao.model.OrderCase;
import com.sure.common.dao.model.QueryCase;
import com.sure.common.dao.model.base.Case;
import com.sure.common.service.model.BaseQueryVO;
import com.sure.user.dao.model.DepartmentPO;
import com.sure.user.dao.model.EmployeePO;

/**
 * 雇员的查询参数VO
 * 
 * @author Sure
 *
 */
public class EmpQueryParamsVO implements Serializable, BaseQueryVO{
	/** 序列化ID*/
	private static final long serialVersionUID = -4625892736505689417L;
	
	/** 雇员ID*/
	private Integer empId;
	/** 雇员姓名*/
	private String empName;
	/** 部门编号*/
	private Integer deptNo;

	public Integer getEmpId() {
		return empId;
	}

	public void setEmpId(Integer empId) {
		this.empId = empId;
	}

	public String getEmpName() {
		return empName;
	}

	public void setEmpName(String empName) {
		this.empName = empName;
	}

	public Integer getDeptNo() {
		return deptNo;
	}

	public void setDeptNo(Integer deptNo) {
		this.deptNo = deptNo;
	}

	@Override
	public List<Case> getCase() {
		List<Case> cases = new ArrayList<Case>();
		//员工编号精确查询
		if(null != this.getEmpId()) {
			QueryCase queryCase = new QueryCase();
			queryCase = new QueryCase();
			queryCase.setColumn(EmployeePO.PROP_ID);
			queryCase.setRelation(QueryCase.EQUALS);
			queryCase.setValue(this.getEmpId());
			cases.add(queryCase);
		}
		//部门编号精确查询
		if(null != this.getDeptNo()) {
			QueryCase queryCase = new QueryCase();
			queryCase.setColumn(DepartmentPO.PROP_ID);
			queryCase.setRelation(QueryCase.EQUALS);
			queryCase.setValue(this.getDeptNo());
			cases.add(queryCase);
		}
		//姓名模糊查询
		if(null != this.getEmpName()) {
			QueryCase queryCase = new QueryCase();
			queryCase.setColumn(EmployeePO.PROP_NAME);
			queryCase.setRelation(QueryCase.LIKE);
			queryCase.setValue(this.getEmpName());
			cases.add(queryCase);
		}
		//薪金降序排列
		OrderCase order = new OrderCase();
		order.setColumn(EmployeePO.PROP_SALARY);
		order.setOrder(OrderCase.DESCEND);
		cases.add(order);
		
		return cases;
	}

}
